package kr.hkit.powerjava.chapter09.submit;

class Plane {
	private static int planes = 0;

	private String productionC;
	private String model;
	private int passenger;
	private int num;

	public Plane(String productionC, String model, int passenger) {
		this.productionC = productionC;
		this.model = model;
		this.passenger = passenger;
		this.num = ++Plane.planes;
	} // 생성자 모든 데이터 받을 경우

	public Plane() {
		this.num = ++Plane.planes;
	} // 생성자 데이터 하나도 받지 않을 경우

	public String getProductionC() {
		return productionC;
	}

	public void setProductionC(String productionC) {
		this.productionC = productionC;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public int getPassenger() {
		return passenger;
	}

	public void setPassenger(int passenger) {
		this.passenger = passenger;
	}

	public int getPlanes() {
		return planes;
	}

	@Override
	public String toString() {
		return "[비행기 제작사: " + productionC + ", 모델명: " + model + ", 최대승객수: "
				+ passenger + "]";
	}
}

public class PlaneTest {
	public static void main(String[] args) {

		Plane p = new Plane();
		p.setProductionC("AirBus");
		p.setModel("A380");
		p.setPassenger(500);
		System.out.println(p);
		System.out.println("비행기 총 " + p.getPlanes() + "대가 생산되었습니다.");

		Plane p2 = new Plane();
		p2.setModel("A400");
		System.out.println(p2);
		System.out.println("비행기 총 " + p.getPlanes() + "대가 생산되었습니다.");

		Plane p3 = new Plane();
		p3.setModel("A500");
		p3.setPassenger(100);
		System.out.println(p3);
		System.out.println("비행기 총 " + p.getPlanes() + "대가 생산되었습니다.");

		Plane p4 = new Plane();
		System.out.println(p4);
		System.out.println("비행기 총 " + p.getPlanes() + "대가 생산되었습니다.");
		
	}
}
